#include<stdio.h>
int main(){
	int N,m;
	scanf("%d",&N);
	for(m=1;m<=N;m++){
		int num,i,j;
		scanf("%d",&num);
		int a[100][100];
        for(i=0;i<num;i++)
		{
		   for(j=0;j<i+1;j++)
		  {
		  	a[i][0] = 1;
		  	a[i][i] = 1;
		  	if(j>=1&&j<=i-1&&i>1)
		  	a[i][j] = a[i-1][j-1] + a[i-1][j];
		  	printf("%d ",a[i][j]);
		  }
		  printf("\n");
	}
	}
}
